public class sfdcemp {

    private final Employee__c emp;
        
    public sfdcemp(ApexPages.StandardController stdController) {
        this.emp= (Employee__c)stdController.getRecord();
    }
  
public PageReference save(){
  try{
    insert emp;
    PageReference newemp= new PageReference('/'+ emp.Id);
     newemp.setRedirect(true);
      return newemp;
      }
   catch (Exception exc) {
       ApexPages.addMessages(exc);
       system.debug(exc);
       return null;
      }
 }
}